Add Format skeleton. From Olaf.
authorrobertl <robertl@f51c46e8-681c-474f-0cfe-069cfd0219fb>
Wed, 31 Aug 2005 14:38:56 +0000 (14:38 +0000)
committerrobertl <robertl@f51c46e8-681c-474f-0cfe-069cfd0219fb>
Wed, 31 Aug 2005 14:38:56 +0000 (14:38 +0000)
gpsbabel/filter_skeleton.c
gpsbabel/format_skeleton.c [new file with mode: 0644]

index abff8df11934eb83fd85fdff1c74813fe9ef48a3..fe6e3b33c0d86e05f0c42715ec38e05bcad3181a 100644 (file)
@@ -2,7 +2,7 @@
 
     Filter skeleton: 
     
-    Simple copy this file to <your_filter_name>.c and 
+    Simply copy this file to <your_filter_name>.c and 
     rename all filter_skeleton tokens to <your_filter_name>. Replace 
     the stupid name and address in the Copyright few lines below.
     To active your new filter you have to create a new section in 
diff --git a/gpsbabel/format_skeleton.c b/gpsbabel/format_skeleton.c
new file mode 100644 (file)
index 0000000..ef891d4
--- /dev/null
@@ -0,0 +1,128 @@
+/*
+
+    Format converter module skeleton.
+
+    Steps to create a new format.
+
+    1) Copy this file to <your_format_name>.c 
+    2) Rename all format_skeleton tokens to <your_format_name>. 
+    3) Replace the fictional name and address in the Copyright section below.
+       As your work is likely built on the work of others, please retain
+       the original line.
+    4) Create a new section in vecs.c.
+    5) Add compilation instructions to Makefile.
+    6) Add sample files (it's better when they're created by the "real" 
+       application and not our own output) to reference/ along with 
+       files in a well supported (preferably non-binary) format and 
+       entries in our 'testo' program.   This allows users of different
+       OSes and hardware to exercise your module.
+
+    Copyright (C) YYYY John Doe, anybody@wherever.com
+    Copyright (C) 2005  Robert Lipe, robertlipe@usa.net
+
+    This program is free software; you can redistribute it and/or modify
+    it under the terms of the GNU General Public License as published by
+    the Free Software Foundation; either version 2 of the License, or
+    (at your option) any later version.
+
+    This program is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+    GNU General Public License for more details.
+
+    You should have received a copy of the GNU General Public License
+    along with this program; if not, write to the Free Software
+    Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111 USA
+
+ */
+#include "defs.h"
+#include <ctype.h>
+
+#define MYNAME "format_skeleton"
+
+
+// Any arg in this list will appear in command line help and will be 
+// populated for you.
+// Values for ARGTYPE_xxx can be found in defs.h and are used to 
+// select the type of option.
+static
+arglist_t format_skeleton_args[] = {
+// {"foo", &fooopt, "The text of the foo option in help", 
+//   "default", ARGYTPE_STRING} , 
+       {0, 0, 0, 0, 0}
+};
+
+/*******************************************************************************
+* %%%        global callbacks called by gpsbabel main process              %%% *
+*******************************************************************************/
+
+static void
+format_skeleton_rd_init(const char *fname)
+{
+//     fin = xfopen("r", fname);
+}
+
+static void 
+format_skeleton_rd_deinit(void)
+{
+//     fclose(fin);
+}
+
+static void
+format_skeleton_read(void)
+{
+//     your special code to extract waypoint, route and track
+//     information from file "fin"
+}
+
+static void
+format_skeleton_rw_init(const char *fname)
+{
+//     fout = xfopen("w", fname);
+}
+
+static void
+format_skeleton_rw_deinit(void)
+{
+//     fclose(fout);
+}
+
+static void
+format_skeleton_write(void)
+{
+// Here is how you register callbacks for all waypoints, routes, tracks.
+// waypt_disp_all(waypt)
+// route_disp_all(head, tail, rtept);
+// track_disp_all(head, tail, trkpt);
+}
+
+static void
+format_skeleton_exit(void)             /* optional */
+{
+}
+
+/**************************************************************************/
+
+// capabilities below means: we can only read and write waypoints
+// please change this depending on your new module 
+
+ff_vecs_t format_skeleton_vecs = {
+       ff_type_file,
+       { 
+               ff_cap_read | ff_cap_write      /* waypoints */, 
+               ff_cap_none                     /* tracks */, 
+               ff_cap_none                     /* routes */
+       },
+       format_skeleton_rd_init,        
+       format_skeleton_wr_init,        
+       format_skeleton_rd_deinit,      
+       format_skeleton_wr_deinit,      
+       format_skeleton_read,
+       format_skeleton_write,
+       format_skeleton_exit,
+       format_skeleton_args,
+       CET_CHARSET_ASCII, 0                    /* ascii is the expected character set */
+                                               /* not fixed, can be changed through command line parameter */
+};
+/**************************************************************************/